package com.step.ems.api

import com.step.ems.api.req.ElevatorReq
import com.step.ems.api.req.LoginReq
import com.step.ems.api.req.UrgentReq
import com.step.ems.api.req.WbReq
import com.step.ems.api.res.ElevatorDetailRes
import com.step.ems.api.res.ElevatorRes
import com.step.ems.api.res.LoginRes
import com.step.ems.api.res.PageRes
import com.step.ems.api.res.Result
import com.step.ems.api.res.UrgentDetailRes
import com.step.ems.api.res.UrgentRes
import com.step.ems.api.res.WbCompleteRes
import com.step.ems.api.res.WbDetailRes
import com.step.ems.api.res.WbItemRes
import com.step.ems.api.res.WbRes
import okhttp3.MultipartBody
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Multipart
import retrofit2.http.POST
import retrofit2.http.Part
import retrofit2.http.Path

interface ApiService {

    @POST("consumer/login")
    suspend fun login(@Body body: LoginReq): Result<LoginRes>

    @POST("elevator/appList")
    suspend fun elevatorList(@Body body: ElevatorReq): Result<PageRes<ElevatorRes>>

    @GET("elevator/vo/{id}")
    suspend fun elevatorDetail(@Path("id") id: Int): Result<ElevatorDetailRes>

    @POST("emergency/appList")
    suspend fun urgentList(@Body body: UrgentReq): Result<PageRes<UrgentRes>>

    @GET("emergency/vo/{id}")
    suspend fun urgentDetail(@Path("id") id: Int): Result<UrgentDetailRes>

    @POST("emergency/receivedAlarm")
    suspend fun urgentReceivedAlarm(@Body body: UrgentRes): Result<Any>

    @POST("emergency/arrived")
    suspend fun urgentArrived(@Body body: UrgentRes): Result<Any>

    @POST("emergency/finished")
    suspend fun urgentFinished(@Body body: UrgentRes): Result<Any>

    @POST("maintenanceOrder/appList")
    suspend fun wbList(@Body body: WbReq): Result<PageRes<WbRes>>

    @GET("maintenanceOrder/vo/{id}")
    suspend fun wbDetail(@Path("id") id: Int): Result<WbDetailRes>

    @POST("maintenanceOrder/signIn")
    suspend fun wbSignIn(@Body body: WbRes): Result<Any>

    @POST("maintenanceOrder/complete")
    suspend fun wbComplete(@Body body: WbCompleteRes): Result<Any>

    @GET("maintenanceTemplate/{id}")
    suspend fun wbItem(@Path("id") id: Int): Result<WbItemRes>

    @Multipart
    @POST("image/upload")
    suspend fun uploadImage(@Part file: MultipartBody.Part): Result<String>

    @GET("emergency/appHomeEmergencies")
    suspend fun urgentNum(): Result<String>

    @GET("maintenanceOrder/appHomeMaintenanceOrders")
    suspend fun wbNum(): Result<String>
}